<template>
  <div>
    <el-tree
      ref="treeRef"
      :data="dataSouse.list"
      show-checkbox
      node-key="roleId"
      :default-checked-keys="dataSouse.authority"
      :check-strictly="true"
      :props="{
        children: 'roleList',
        label: 'name',
      }"
    />
    <el-button @click="changeauthority" type="primary">确认修改</el-button>
  </div>
</template>

<script setup lang="ts">
import { reactive } from '@vue/reactivity'
import { useRoute } from 'vue-router'
import { initData } from '../../type/authority'
import { getAuthorityList } from '../../api/api'
import { onMounted } from '@vue/runtime-core'
import { ref } from 'vue'
const route = useRoute()
console.log(route)
const params: any = route.params
console.log(params)
const dataSouse = reactive(new initData(params.id, params.authority))
const getData = async () => {
  const res = await getAuthorityList()
  console.log('权限列表', res)
  dataSouse.list = res.data
}
const changeauthority = () => {
  const treeRef = ref(null)
  console.log(treeRef)
}
onMounted(() => {
  getData()
})
</script>

<style scoped lang="less"></style>
